﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Wolfut.MirageEE.UI.UIBaseComponents
{
    public partial class ExceptionForm : Form
    {
        public ExceptionForm()
        {
            InitializeComponent();
        }

        private Exception _ExceptionInfo = null;
        public Exception ExceptionInfo
        {
            get
            {
                return _ExceptionInfo;
            }
            set
            {
                _ExceptionInfo = value;
            }
        }

        private void ButtonClose_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

        private void ExceptionForm_Load(object sender, System.EventArgs e)
        {
            this.TextBox1.Height = 0;
            this.Height = 136;

            this.boolTag = true;
            this.ButtonDetail.Text = "Detail >>";
            if (this.ExceptionInfo != null)
            {
                TextBox1.Text = this.ExceptionInfo.Message;
            }
        }

        private void ButtonDetail_Click(object sender, System.EventArgs e)
        {
            if (boolTag)
            {
                this.boolTag = false;
                this.Height = 400;
                this.TextBox1.Height = 240;
                this.ButtonDetail.Text = "Detail <<";
            }
            else
            {
                this.boolTag = true;
                this.TextBox1.Height = 0;
                this.Height = 150;
                this.ButtonDetail.Text = "Detail >>";
            }
        }

        private void ExceptionForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
#if (!DEBUG) 
				Application.Exit();
#endif
        }

        public void DisplayMessage(string strMessage)
        {
            this.TextBox1.Text = strMessage;
        } 
    }
}
